#include "udp_server.hpp"
#include <iostream>
#include <memory>

void Usage()
{
    std::cout << "Please enter the correct format: " << std::endl
              << "      ./server [port]" << std::endl;
}

std::string ChatService(const std::string &str)
{
    return str;
}

// ./udp_server port
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage();
        exit(USAGE_ERR);
    }

    uint16_t server_port = atoi(argv[1]);

    std::unique_ptr<UdpServer> usvr(new UdpServer(server_port, ChatService));
    usvr->Initial();
    usvr->Start();

    return 0;
}